package com.bee.beemanage.system.common.utils.pages;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.ArrayList;
import java.util.List;

/**
 * 分页排序工具
 */
public class PageUtils {
    public static <T> void start(long current, long size, String orderColumn, Boolean orderAsc, Page<T> page) {
        page.setCurrent(current);
        page.setSize(size);
        List<OrderItem> orders = new ArrayList<>();
        OrderItem orderItem = new OrderItem();
        if(null!=orderColumn)orderItem.setColumn(orderColumn);
        if(null!=orderAsc)orderItem.setAsc(orderAsc);
        orders.add(orderItem);
        page.setOrders(orders);
    }
}
